package aryn.framework.display.drawable;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Shape;

import aryn.framework.display.MyCanvas;

public class DrawingShape extends Drawable {

	private Shape shape;
	private boolean fill;
	private Color color;
	
	public DrawingShape(int x, int y, Shape shape, Priority priority, Color color, boolean fill, MyCanvas canvas) {
		super(x, y, priority, canvas);
		this.shape = shape;
		this.fill = fill;
		this.color = color;
	}
	
	public DrawingShape(int x, int y, Shape shape, MyCanvas canvas) {
		this(x, y, shape, Priority.MIDDLE_FORE, null, false, canvas);
	}

	@Override
	public void draw(Graphics g) {
		Graphics2D g2d = (Graphics2D) g;
		Color last = g2d.getColor();
		g2d.setPaint(color);
		if (fill) g2d.fill(shape);
		else 	  g2d.draw(shape);
		g2d.setColor(last);
	}

	@Override
	public boolean isMouseOver(int mouseX, int mouseY) {
		return shape.contains(mouseX, mouseY);
	}
	
	public Shape getShape() {
		return shape;
	}
	public void setShape(Shape shape) {
		this.shape = shape;
	}
	public boolean isFill() {
		return fill;
	}
	public void setFill(boolean fill) {
		this.fill = fill;
	}

}
